<%@ page language="java" %>

<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 
<jsp:useBean id="attachDetailView" scope="request" type="com.broadvision.web.util.ViewDynaBean"/> 
<bean:define id="filePath" name="attachDetailView" property="filePath"/>
<bean:define id="version" name="attachDetailView" property="version"/>
<bean:size id="parentSize" name="attachDetailView" property="parentList"/>
<form action="<html:rewrite page='<%="/download" + filePath %>'/>" target="download">

<SCRIPT language="javascript">
 function doWebflowAction(cntOID, version ,cntAction){
   var theURL="/cm/launchVSWebflow.do";
   var theParam="?guid="+cntOID+"&version="+version+
             "&launchAction="+cntAction+"&exitURL="+"/cm/closeWindow.do";
   var url ='<html-el:rewrite page="'+theURL+'" />'+theParam;
   var qualifier = window.open(url, "ContentServiceLaunchProcess",
                               "directories=no,height=500,width=650,left=50,top=50,resizable=yes,scrollbars=yes,location=yes,menubar=yes,status=yes,toolbar=yes");

  if (qualifier != null){
    if (qualifier.opener == null)
        qualifier.opener = self;
    qualifier.focus();
  }

 }
</script>

<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean:message  bundle="cm.messages"key="cm.content.attDetails"/>">
  <tr> 
  <td valign="top" width="100%">
		  
  <div class="pageTitle"><bean:message  bundle="cm.messages" bundle="cm.messages"key="cm.content.attDetails"/></div>
  
  <div class="pageSubtitle">
    <span class="left"><bean:message  bundle="cm.messages"key="cm.content.attDetailInfo"/></span>
    <span class="right">&nbsp;</span>
  </div> 

  <form action="<html:rewrite page='<%="/download" + filePath %>'/>" target="download">          
  <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean:message  bundle="cm.messages"key="cm.content.attDetails"/>">
    <tr>
      <td valign="top" width="25%" class="label"><bean:message  bundle="cm.messages"key="cm.content.contentName"/>:</td>
      <td valign="top" class="labelField" width="75%">
       <bean:write name="attachDetailView" property="contentName"/>  <input type=submit value="<bean:message  bundle="cm.messages"key="cm.content.viewAttachmentInside"/>"/>
      </td
    </tr>
    <tr>
      <td valign="top" width="25%" class="label"><bean:message  bundle="cm.messages"key="cm.content.version"/>:</td>
      <td valign="top" class="labelField" width="75%"><bean:write name="attachDetailView" property="version"/></td>
    </tr>
    <tr>
      <td valign="top" width="25%" class="label"><bean:message  bundle="cm.messages"key="cm.content.type"/>:</td>
      <td valign="top" class="labelField" width="75%"><bean:write name="attachDetailView" property="contentObjectType"/></td>
    </tr>
    <tr>
      <td valign="top" width="25%" class="label"><bean:message  bundle="cm.messages"key="cm.content.checkedOutBy"/>:</td>
      <td valign="top" class="labelField" width="75%"><bean:write name="attachDetailView" property="checkedOutBy"/></td>
    </tr>
    <tr>
      <td valign="top" width="25%" class="label"><bean:message  bundle="cm.messages"key="cm.content.contentCreationDate"/>:</td>
      <td valign="top" class="labelField" width="75%"><bean:write name="attachDetailView" property="objectCreatedTime"/></td>
    </tr>
    <tr>
      <td valign="top" width="25%" class="label"><bean:message  bundle="cm.messages"key="cm.content.contentModificationDate"/>:</td>
      <td valign="top" class="labelField" width="75%"><bean:write name="attachDetailView" property="versionCreatedTime"/></td>
    </tr>
  </table>
  </form>
		  
  <br>

  <div class="pageSubtitle">
    <span class="left"><bean:message  bundle="cm.messages"key="cm.content.parentList" /></span>
    <span class="right">&nbsp;</span>
  </div>
    
  <table class="dataTable" border="0" cellspacing="1" cellpadding="2" width="100%" summary="<bean:message  bundle="cm.messages"key="cm.content.parentList"/>">
  <tr class="listHeader"> 
    <th id="Content Name" align="left"><bean:message  bundle="cm.messages"key="cm.content.contentName"/></th>
    <th id="Version" align="left"><bean:message  bundle="cm.messages"key="cm.content.version"/></th>
    <th id="Type" align="left" nowrap><bean:message  bundle="cm.messages"key="cm.content.type"/></th>
    <th id="Modified on" align="left" nowrap><bean:message  bundle="cm.messages"key="cm.content.modifiedOn"/></th>
    <th id="Modified by" align="left" nowrap><bean:message  bundle="cm.messages"key="cm.content.modifiedBy"/></th>
    <th id="Checked out by" align="left" nowrap><bean:message  bundle="cm.messages"key="cm.content.checkedOutBy"/></th>
    <th id="Process Instance" align="left" nowrap><bean:message  bundle="cm.messages"key="cm.content.processInstance"/></th>
  </tr>

  <logic:equal name="parentSize" value="0">
  <tr class="listEven"> 
    <td colspan="7" valign="top" align="center"><bean:message  bundle="cm.messages"key="cm.content.noParentContentFound"/></td>
  </tr>
  </logic:equal>   

  <logic:iterate id="parent" name="attachDetailView" property="parentList" indexId="index">  
    <tr class='<%=index.intValue() %2 == 0 ? "listEven" : "listOdd"%>'>
      <td headers="Content Name" align="center">
       <a href="JavaScript:doWebflowAction('<bean:write name="parent" property="oid"/>',
                                           '<bean:write name="parent" property="version"/>', 'View')" >
         <bean:write name="parent" property="contentName"/>
      </td>
      <td headers="Version"><bean:write name="parent" property="version"/></td>
      <td headers="Type" align="center"><bean:write name="parent" property="contentObjectType"/></td>
      <td headers="Modified on"><bean:write name="parent" property="versionCreatedTime"/></td>
      <td headers="Modified by"><bean:write name="parent" property="versionCreatedBy"/></td>
      <td headers="Checked out by" align="center"><bean:write name="parent" property="checkedOutBy"/></td>
      <td headers="Process Instance" align="center"><bean:write name="parent" property="processInstanceName"/>
      </td>
    </tr>
  </logic:iterate>
  </table>
  
  </td>
  </tr>
</table>  
